﻿using BasicInformation.ApiRead.Application.Command.IType;
using BasicInformation.ApiRead.Application.Command.Result;
using BasicInformation.Domain;
using BasicInformation.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicInformation.ApiRead.Controllers
{
    /// <summary>
    /// 库存盘点结果控制器——读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ResultController : ControllerBase
    {
        private readonly IMediator mediator;

        public ResultController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 库存盘点结果
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<ResultModel>> GetResult([FromQuery] GetResultCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 库存盘类型
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<ITypeModel>> GetIType([FromQuery] GetITypeCommand request)
        {
            return await mediator.Send(request);
        }
    }
}